package it.pecuswap.backend.services;

import it.pecuswap.backend.business.UtentiBusiness;
import it.pecuswap.backend.exceptions.EntityHomeException;
import it.pecuswap.commons.client.rest.interfaces.UtentiServiceInterface;
import it.pecuswap.commons.client.rest.parameters.LoginParameter;
import it.pecuswap.commons.dto.UtentiDTO;
import it.pecuswap.commons.exceptions.PecuswapRestException;

import javax.ws.rs.Path;

import org.apache.log4j.Logger;

/**
 * Implementazione dei servizi relativi all'utente. Rest entry point
 * @author Ruggiero
 *
 */

//TODO: verificare chiamate multithread

@Path("/")
public class UtentiService implements UtentiServiceInterface{
	
	private static final Logger LOGGER = Logger.getLogger(UtentiService.class);
	private UtentiBusiness utentiBusiness;
	
	public UtentiService(){
		this.utentiBusiness = new UtentiBusiness();
	}

	@Override
	public UtentiDTO login(LoginParameter param) throws PecuswapRestException {
		try {
			return utentiBusiness.login(param);
		} catch (EntityHomeException e) {
			throw new PecuswapRestException();
		}
	}
    

}